if SERVER then

/* Create player info */
function InsertPlayerInfo( ply )

	/* Ensure valid player */
	if not player.IsValid( ply ) then
		DEBUG:ErrMsg( "Invalid player: " .. tostring( ply ), "InsertPlayerInfo" )
		return false
	end

	/* Variables */
	local steamID		= SQLStr( ply:SteamID() )
	local firstJoin		= tostring( os.time() )
	local lastJoin		= tostring( os.time() )
	local money			= "0"
	
	/* Debug output */
	DEBUG:Msg( "Creating player info for steam ID " .. steamID, "InsertPlayerInfo" )
	
	/* Prepare the query */
	local query = "INSERT INTO PlayerInfo ( 'SteamID', 'FirstJoin', 'LastJoin', 'Money' ) VALUES ( " .. steamID .. ", " .. firstJoin .. ", " .. lastJoin .. ", " .. money .. " )"
	
	/* Execute the query */
	local result		= sql.Query( query )
	
	/* Debut output */
	if IsSQLError( result ) then
		DEBUG:ErrMsg( "Insert failed: " .. tostring( sql.LastError() ), "InsertPlayerInfo" )
	else
		DEBUG:Msg( "Insert result: " .. tostring( result ) .. " - Last error: " .. tostring( sql.LastError() ), "InsertPlayerInfo" )
	end
	
	/* Return the result */
	return result
end

/* Create object type */
function InsertObjectType( objType )

	/* Ensure parameter is valid */
	if not IsValidInstance( objType, ObjectType ) then
		DEBUG:ErrMsg( "Invalid object type: " .. tostring( objType ), "InsertObjectType" )
		return false
	end
	
	/* Variables */
	local id				= tostring( objType.ID )
	local name				= SQLStr( tostring( objType.Name ) )
	local className			= SQLStr( tostring( objType.ClassName ) )
	
	/* Check if the row already exists */
	local result			= sql.Query( "SELECT ID FROM ObjectType WHERE ID = " .. id )
	if result then
		DEBUG:Msg( "Skipped creation of object type '" .. tostring( objType.Name ) .. "' because it already exists", "InsertObjectType" )
	else
		
		/* Prepare the query */
		local query		= "INSERT INTO ObjectType ( 'ID', 'Name', 'ClassName' )"
		query = query .. " VALUES ( " .. id .. ", " .. name .. ", " .. className .. " )"
	
		/* Insert team row */
		result				= sql.Query( query )
		if IsSQLError( result ) then
			DEBUG:ErrMsg( "An error occurred while trying to create the object type " .. tostring( objType.Name ) .. " -  " .. tostring( sql.LastError() ), "InsertObjectType" )
		else
			DEBUG:Msg( "The object type " .. tostring( objType.Name ) .. " row was successfully inserted", "InsertObjectType" )
		end
	end
	
	/* Return the result */
	return result
end

/* Create object reference type */
function InsertObjRefType( ortObj )

	/* Ensure parameter is valid */
	if not IsValidInstance( ortObj, ObjRefType ) then
		DEBUG:ErrMsg( "Invalid object reference type: " .. tostring( ortObj ), "InsertObjRefType" )
		return false
	end
	
	/* Variables */
	local id	= tostring( ortObj.ID )
	local name	= SQLStr( tostring( ortObj.Name ) )
	
	/* Check if the row already exists */
	local result			= sql.Query( "SELECT ID FROM ObjRefType WHERE ID = " .. id )
	if result then
		DEBUG:Msg( "Skipped creation of object reference type '" .. tostring( ortObj.Name ) .. "' because it already exists", "InsertObjRefType" )
	else
		
		/* Prepare the query */
		local query		= "INSERT INTO ObjRefType ( 'ID', 'Name' )"
		query = query .. " VALUES ( " .. id .. ", " .. name .. " )"
	
		/* Insert team row */
		result				= sql.Query( query )
		if IsSQLError( result ) then
			DEBUG:ErrMsg( "An error occurred while trying to create the object reference type " .. tostring( ortObj.Name ) .. " -  " .. tostring( sql.LastError() ), "InsertObjRefType" )
		else
			DEBUG:Msg( "The object reference type " .. tostring( ortObj.Name ) .. " row was successfully inserted", "InsertObjRefType" )
		end
	end
	
	/* Return the result */
	return result
end

/* Create level info */
function InsertLevelInfo( levelObj )

	/* Ensure level object is valid */
	if not IsValidInstance( levelObj, LevelInfo ) then
		DEBUG:ErrMsg( "Invalid level info: " .. tostring( levelObj ), "InsertLevelInfo" )
		return false
	end
	
	/* Variables */
	local num			= tostring( levelObj.Num )
	local requiredXp	= tostring( levelObj.RequiredXp )
	
	/* Check if the team row already exists */
	local result			= sql.Query( "SELECT Num FROM LevelInfo WHERE Num = " .. num )
	if result then
		DEBUG:Msg( "Skipped creation of level info '" .. num .. "' because it already exists", "InsertLevelInfo" )
	else
		
		/* Prepare the query */
		local query		= "INSERT INTO LevelInfo ( 'Num', 'RequiredXp' )"
		query = query .. " VALUES ( " .. num .. ", " .. requiredXp .. " )"
	
		/* Insert team row */
		result				= sql.Query( query )
		if IsSQLError( result ) then
			DEBUG:ErrMsg( "An error occurred while trying to create the level info " .. num .. " -  " .. tostring( sql.LastError() ), "InsertLevelInfo" )
		else
			DEBUG:Msg( "The level info " .. num .. " row was successfully inserted", "InsertLevelInfo" )
		end
	end
	
	/* Return the result */
	return result
end

/* Create object info */
function InsertObjectInfo( objInfo )

	/* Ensure parameter is valid */
	if not IsValidInstance( objInfo, ObjectInfo ) then
		DEBUG:ErrMsg( "Invalid object info: " .. tostring( objInfo ), "InsertObjectInfo" )
		return false
	end
	
	/* Validate object type */
	if not IsValidInstance( objInfo.Type, ObjectType ) then
		DEBUG:ErrMsg( "Invalid object type for " .. tostring( objInfo.Name ) .. ": " .. tostring( objInfo.Type ), "InsertObjectInfo" )
		return false
	end
	
	/* Validate reference type */
	if not IsValidInstance( objInfo.ReferenceType, ObjRefType ) then
		DEBUG:ErrMsg( "Invalid object reference type for " .. tostring( objInfo.Name ) .. ": " .. tostring( objInfo.ReferenceType ), "InsertObjectInfo" )
		return false
	end
	
	/* Variables */
	local id			= tostring( objInfo.ID )
	local name			= SQLStr( tostring( objInfo.Name ) )
	local health		= tostring( objInfo.Health )
	local weight		= tostring( objInfo.Weight )
	local tp			= tostring( objInfo.Type.ID )
	local reference		= SQLStr( tostring( objInfo.Reference ) )
	local referenceType	= tostring( objInfo.ReferenceType.ID )
	local price			= tostring( objInfo.Price )
	
	/* Check if the row already exists */
	local result			= sql.Query( "SELECT ID FROM ObjectInfo WHERE ID = " .. id )
	if result then
		DEBUG:Msg( "Skipped creation of object info '" .. tostring( objInfo.Name ) .. "' because it already exists", "InsertObjectInfo" )
	else
		
		/* Prepare the query */
		local query		= "INSERT INTO ObjectInfo ( 'ID', 'Name', 'Health', 'Weight', 'Type', 'Reference', 'ReferenceType', 'Price' )"
		query = query .. " VALUES ( " .. id .. ", " .. name .. ", " .. health .. ", " .. weight .. ", " .. tp .. ", " .. reference .. ", " .. referenceType.. ", " .. price .. " )"
	
		/* Insert team row */
		result				= sql.Query( query )
		if IsSQLError( result ) then
			DEBUG:ErrMsg( "An error occurred while trying to create the object info " .. tostring( objInfo.Name ) .. " -  " .. tostring( sql.LastError() ), "InsertObjectInfo" )
		else
			DEBUG:Msg( "The object info " .. tostring( objInfo.Name ) .. " row was successfully inserted", "InsertObjectInfo" )
		end
	end
	
	/* Return the result */
	return result
end

/* CreateLoadout */
function InsertLoadout( loadoutObj )

	/* Ensure parameter is valid */
	if not IsValidInstance( loadoutObj, Loadout ) then
		DEBUG:ErrMsg( "Invalid loadout: " .. tostring( loadoutObj ), "InsertLoadout" )
		return false
	end
	
	/* Validate primary */
	local primary	= "NULL"
	if not IsValidInstance( loadoutObj.Primary, ObjectInfo ) then
		DEBUG:Msg( "Invalid primary weapon for " .. tostring( loadoutObj.Name ) .. ": " .. tostring( loadoutObj.Primary ), "InsertLoadout" )
	else
		primary		= loadoutObj.Primary.ID
	end
	
	/* Validate secondary */
	local secondary	= "NULL"
	if not IsValidInstance( loadoutObj.Secondary, ObjectInfo ) then
		DEBUG:Msg( "Invalid secondary weapon for " .. tostring( loadoutObj.Name ) .. ": " .. tostring( loadoutObj.Secondary ), "InsertLoadout" )
	else
		secondary	= loadoutObj.Secondary.ID
	end
	
	/* Validate inventory 1 */
	local inv1		= "NULL"
	if not IsValidInstance( loadoutObj.Inventory1, ObjectInfo ) then
		DEBUG:Msg( "Invalid first inventory item for " .. tostring( loadoutObj.Name ) .. ": " .. tostring( loadoutObj.Inventory1 ), "InsertLoadout" )
	else
		inv1		= loadoutObj.Inventory1.ID
	end
	
	/* Validate inventory 2 */
	local inv2		= "NULL"
	if not IsValidInstance( loadoutObj.Inventory2, ObjectInfo ) then
		DEBUG:Msg( "Invalid second inventory item for " .. tostring( loadoutObj.Name ) .. ": " .. tostring( loadoutObj.Inventory2 ), "InsertLoadout" )
	else
		inv2		= loadoutObj.Inventory2.ID
	end
	
	/* Validate backpack 1 */
	local backpack1	= "NULL"
	if not IsValidInstance( loadoutObj.Backpack1, ObjectInfo ) then
		DEBUG:Msg( "Invalid first backpack object for " .. tostring( loadoutObj.Name ) .. ": " .. tostring( loadoutObj.Backpack1 ), "InsertLoadout" )
	else
		backpack1	= loadoutObj.Backpack1.ID
	end
	
	/* Validate backpack 2 */
	local backpack2	= "NULL"
	if not IsValidInstance( loadoutObj.Backpack2, ObjectInfo ) then
		DEBUG:Msg( "Invalid second backpack object for " .. tostring( loadoutObj.Name ) .. ": " .. tostring( loadoutObj.Backpack2 ), "InsertLoadout" )
	else
		backpack2	= loadoutObj.Backpack2.ID
	end
	
	/* Variables */
	local id		= tostring( loadoutObj.ID )
	local name		= SQLStr( tostring( loadoutObj.Name ) )
	
	/* Check if the row already exists */
	local result			= sql.Query( "SELECT ID FROM Loadout WHERE ID = " .. id )
	if result then
		DEBUG:Msg( "Skipped creation of loadout '" .. tostring( loadoutObj.Name ) .. "' because it already exists", "InsertLoadout" )
	else
		
		/* Prepare the query */
		local query		= "INSERT INTO Loadout ( 'ID', 'Name', 'PrimaryWeapon', 'SecondaryWeapon', 'Inventory1', 'Inventory2', 'Backpack1', 'Backpack2' )"
		query = query .. " VALUES ( " .. id .. ", " .. name .. ", " .. primary .. ", " .. secondary .. ", " .. inv1 .. ", " .. inv2 .. ", " .. backpack1 .. ", " .. backpack2 .. " )"
	
		/* Insert team row */
		result				= sql.Query( query )
		if IsSQLError( result ) then
			DEBUG:ErrMsg( "An error occurred while trying to create the loadout " .. tostring( loadoutObj.Name ) .. " -  " .. tostring( sql.LastError() ), "InsertLoadout" )
		else
			DEBUG:Msg( "The loadout " .. tostring( loadoutObj.Name ) .. " (" .. tostring( loadoutObj.ID ) .. ") row was successfully inserted", "InsertLoadout" )
		end
	end
	
	/* Return the result */
	return result
end

/* CreateTeamInfo */
function InsertTeamInfo( teamObj )

	/* Ensure team is valid */
	local tm				= team.GetInfo( teamObj )
	if not tm then
		DEBUG:ErrMsg( "Team not found: " .. tostring( teamObj ), "InsertTeamInfo" )
		return false
	end
	
	/* Validate loadout */
	if not IsValidInstance( tm.DefaultLoadout, Loadout ) then
		DEBUG:ErrMsg( "Invalid object type for " .. tostring( tm.Name ) .. ": " .. tostring( tm.DefaultLoadout ), "InsertTeamInfo" )
		return false
	end
	
	/* Variables */
	local id			= tostring( tm.ID )
	local name			= SQLStr( tostring( tm.Name ) )
	local color			= SQLStr( table.ToString( tm.Color ) )
	local maxPercent	= tostring( tm.MaxPercent )
	local chatName		= SQLStr( tostring( tm.ChatName ) )
	local defLoadout	= tostring( tm.DefaultLoadout.ID )
	local createTime	= tostring( os.time() )
	
	/* Debug output */
	DEBUG:Msg( "ID: " .. id, "InsertTeamInfo" )
	DEBUG:Msg( "Name: " .. name, "InsertTeamInfo" )
	DEBUG:Msg( "Color: " .. color, "InsertTeamInfo" )
	DEBUG:Msg( "Max percent: " .. maxPercent, "InsertTeamInfo" )
	DEBUG:Msg( "Chat name: " .. chatName, "InsertTeamInfo" )
	DEBUG:Msg( "Default loadout: " .. defLoadout, "InsertTeamInfo" )
	DEBUG:Msg( "Create time: " .. createTime, "InsertTeamInfo" )
	
	/* Check if the row already exists */
	local result			= sql.Query( "SELECT ID FROM TeamInfo WHERE ID = " .. id )
	if result then
		DEBUG:Msg( "Skipped creation of '" .. tostring( tm.ChatName ) .. "' team info because it already exists", "InsertTeamInfo" )
	else
		
		/* Prepare the query */
		local query		= "INSERT INTO TeamInfo ( 'ID', 'Name', 'Color', 'MaxPercent', 'ChatName', 'DefaultLoadout', 'CreateTime' )"
		query = query .. " VALUES ( " .. id .. ", " .. name .. ", " .. color .. ", " .. maxPercent .. ", " .. chatName .. ", " .. defLoadout .. ", " .. createTime .. " )"
	
		/* Insert team row */
		result				= sql.Query( query )
		if IsSQLError( result ) then
			DEBUG:ErrMsg( "An error occurred while trying to create the " .. tostring( tm.ChatName ) .. " team -  " .. tostring( sql.LastError() ), "InsertTeamInfo" )
		else
			DEBUG:Msg( "The " .. tostring( tm.ChatName ) .. " team row was successfully inserted", "InsertTeamInfo" )
		end
	end
	
	/* Return the result */
	return result
end

/* Create upgrade info */
function InsertUpgradeInfo( upgInfo )

	/* Ensure parameter is valid */
	if not IsValidInstance( upgInfo, UpgradeInfo ) then
		DEBUG:ErrMsg( "Invalid upgrade info: " .. tostring( upgInfo ), "InsertUpgradeInfo" )
		return false
	end
	
	/* Validate object */
	if not IsValidInstance( upgInfo.Object, ObjectInfo ) then
		DEBUG:ErrMsg( "Invalid object info for " .. tostring( upgInfo.Name ) .. ": " .. tostring( upgInfo.Object ), "InsertUpgradeInfo" )
		return false
	end
	
	/* Validate level */
	if not IsValidInstance( upgInfo.Level, LevelInfo ) then
		DEBUG:ErrMsg( "Invalid level info for " .. tostring( upgInfo.Name ) .. ": " .. tostring( upgInfo.Level ), "InsertUpgradeInfo" )
		return false
	end
	
	/* Variables */
	local id			= tostring( upgInfo.ID )
	local name			= SQLStr( tostring( upgInfo.Name ) )
	local level			= tostring( upgInfo.Level.ID )
	local addHealth		= tostring( upgInfo.AddHealth )
	local addWeight		= tostring( upgInfo.AddWeight )
	local price			= tostring( upgInfo.Price )
	local object		= tostring( upgInfo.Object.ID )
	local previous		= "NULL"
	local nxt			= "NULL"
	
	/* References to next and previous */
	if IsValidInstance( upgInfo.Previous, UpgradeInfo ) then previous = upgInfo.Previous.ID end
	if IsValidInstance( upgInfo.Next, UpgradeInfo ) then nxt = upgInfo.Next.ID end
	
	/* Check if the row already exists */
	local result			= sql.Query( "SELECT ID FROM UpgradeInfo WHERE ID = " .. id )
	if result then
		DEBUG:Msg( "Skipped creation of upgrade info '" .. tostring( upgInfo.Name ) .. "' because it already exists", "InsertUpgradeInfo" )
	else
		
		/* Prepare the query */
		local query		= "INSERT INTO UpgradeInfo ( 'ID', 'Name', 'Level', 'AddHealth', 'AddWeight', 'Price', 'Object', 'Previous', 'Next' )"
		query = query .. " VALUES ( " .. id .. ", " .. name .. ", " .. level .. ", " .. addHealth .. ", " .. addWeight .. ", " .. price .. ", " .. object .. ", " .. previous .. ", " .. nxt .. " )"
	
		/* Insert team row */
		result				= sql.Query( query )
		if IsSQLError( result ) then
			DEBUG:ErrMsg( "An error occurred while trying to create the upgrade info " .. tostring( upgInfo.Name ) .. " -  " .. tostring( sql.LastError() ), "InsertUpgradeInfo" )
		else
			DEBUG:Msg( "The upgrade info " .. tostring( upgInfo.Name ) .. " row was successfully inserted", "InsertUpgradeInfo" )
		end
	end
	
	/* Return the result */
	return result
end

/* Create player stats */
function InsertPlayerStats( plyStats )

	/* Ensure parameter is valid */
	if not IsValidInstance( plyStats, PlayerStats ) then
		DEBUG:ErrMsg( "Invalid player stats: " .. tostring( plyStats ), "InsertPlayerStats" )
		return false
	end
	
	/* Validate player */
	if not player.IsValid( plyStats.Player ) then
		DEBUG:ErrMsg( "Invalid player for " .. tostring( plyStats ) .. ": " .. tostring( plyStats.Player ), "InsertPlayerStats" )
		return false
	end
	
	/* Validate team */
	if not team.Valid( plyStats.Team ) then
		DEBUG:ErrMsg( "Invalid team info for " .. tostring( plyStats ) .. ": " .. tostring( plyStats.Team ), "InsertPlayerStats" )
		return false
	end
	
	/* Variables */
	local dbgName	= tostring( plyStats.Player:SteamID() ) .. ", " .. tostring( plyStats.Team.ID )
	
	/* Validate level */
	if not IsValidInstance( plyStats.Level, LevelInfo ) then
		DEBUG:ErrMsg( "Invalid level info for " .. dbgName .. ": " .. tostring( plyStats.Level ), "InsertPlayerStats" )
		return false
	end
	
	/* Variables */
	local steamID		= SQLStr( tostring( plyStats.Player:SteamID() ) )
	local teamID		= tostring( plyStats.Team.ID )
	local kills			= tostring( plyStats.Kills )
	local deaths		= tostring( plyStats.Deaths )
	local rescued		= tostring( plyStats.Rescued )
	local escaped		= tostring( plyStats.Escaped )
	local friendsKilled	= tostring( plyStats.FriendsKilled )
	local enemiesRescued= tostring( plyStats.EnemiesRescued )
	local experience	= tostring( plyStats.Experience )
	local level			= tostring( plyStats.Level.ID )
	
	/* Check if the row already exists */
	local result			= sql.Query( "SELECT SteamID, TeamID FROM PlayerStats WHERE SteamID = " .. steamID .. " AND TeamID = " .. teamID )
	if result then
		DEBUG:Msg( "Skipped creation of player stats '" .. dbgName .. "' because it already exists", "InsertPlayerStats" )
	else
		
		/* Prepare the query */
		local query		= "INSERT INTO PlayerStats ( 'SteamID', 'TeamID', 'Kills', 'Deaths', 'Rescued', 'Escaped', 'FriendsKilled', 'EnemiesRescued', 'Experience', 'Level' )"
		query = query .. " VALUES ( " .. steamID .. ", " .. teamID .. ", " .. kills .. ", " .. deaths .. ", " .. rescued .. ", " .. escaped
		query = query .. ", " .. friendsKilled .. ", " .. enemiesRescued .. ", " .. experience .. ", " .. level .. " )"
	
		/* Insert team row */
		result				= sql.Query( query )
		if IsSQLError( result ) then
			DEBUG:ErrMsg( "An error occurred while trying to create the player stats " .. dbgName .. " -  " .. tostring( sql.LastError() ), "InsertPlayerStats" )
		else
			DEBUG:Msg( "The player stats " .. dbgName .. " row was successfully inserted", "InsertPlayerStats" )
		end
	end
	
	/* Return the result */
	return result
end

/* Create player upgrade */
function InsertPlayerUpgrade( plyUpg )

	/* Ensure parameter is valid */
	if not IsValidInstance( plyUpg, PlayerUpgrade ) then
		DEBUG:ErrMsg( "Invalid player upgrade: " .. tostring( plyUpg ), "InsertPlayerUpgrade" )
		return false
	end
	
	/* Validate player */
	if not player.IsValid( plyStats.Player ) then
		DEBUG:ErrMsg( "Invalid player for " .. tostring( plyUpg ) .. ": " .. tostring( plyStats.Player ), "InsertPlayerUpgrade" )
		return false
	end
	
	/* Validate team */
	if not team.Valid( plyStats.Team ) then
		DEBUG:ErrMsg( "Invalid upgrade info for " .. tostring( plyUpg ) .. ": " .. tostring( plyStats.Upgrade ), "InsertPlayerUpgrade" )
		return false
	end
	
	/* Variables */
	local dbgName	= tostring( plyUpg.Player:SteamID() ) .. ", " .. tostring( plyUpg.Upgrade.Name )
	
	/* Variables */
	local steamID		= SQLStr( tostring( plyUpg.Player:SteamID() ) )
	local upgrade		= tostring( plyUpg.Upgrade.ID )
	local dateAcquired	= tostring( plyUpg.DateAcquired )
	
	/* Check if the row already exists */
	local result			= sql.Query( "SELECT SteamID, Upgrade FROM PlayerUpgrade WHERE SteamID = " .. steamID .. " AND Upgrade = " .. upgrade )
	if result then
		DEBUG:Msg( "Skipped creation of player upgrade '" .. dbgName .. "' because it already exists", "InsertPlayerUpgrade" )
	else
		
		/* Prepare the query */
		local query		= "INSERT INTO PlayerUpgrade ( 'SteamID', 'Upgrade', 'DateAcquired' )"
		query = query .. " VALUES ( " .. steamID .. ", " .. upgrade .. ", " .. dateAcquired .. " )"
	
		/* Insert team row */
		result				= sql.Query( query )
		if IsSQLError( result ) then
			DEBUG:ErrMsg( "An error occurred while trying to create the player upgrade " .. dbgName .. " -  " .. tostring( sql.LastError() ), "InsertPlayerUpgrade" )
		else
			DEBUG:Msg( "The player upgrade " .. dbgName .. " row was successfully inserted", "InsertPlayerUpgrade" )
		end
	end
	
	/* Return the result */
	return result
end

/* Create user info */
function InsertUserInfo( usrInfo )

	/* Ensure parameter is valid */
	if not IsValidInstance( usrInfo, UserInfo ) then
		DEBUG:ErrMsg( "Invalid user info: " .. tostring( usrInfo ), "InsertUserInfo" )
		return false
	end
	
	/* Validate player */
	local steamID		= nil
	if not player.IsValid( usrInfo.Player ) then
		DEBUG:Msg( "Invalid player for " .. tostring( usrInfo ) .. ": " .. tostring( usrInfo.Player ), "InsertUserInfo" )
		steamID			= SQLStr( tostring( usrInfo.Player ) )
	else
		steamID			= SQLStr( tostring( usrInfo.Player:SteamID() ) )
	end
	
	/* Variables */
	local dbgName	= tostring( usrInfo.Player )
	
	/* Variables */
	local login			= SQLStr( tostring( usrInfo.Login ) )
	local password		= SQLStr( tostring( usrInfo.Password ) )
	local adminLevel	= tostring( usrInfo.AdminLevel )
	
	/* Check if the row already exists */
	local result			= sql.Query( "SELECT SteamID FROM UserInfo WHERE SteamID = " .. steamID )
	if result then
		DEBUG:Msg( "Skipped creation of user info '" .. dbgName .. "' because it already exists", "InsertUserInfo" )
	else
		
		/* Prepare the query */
		local query		= "INSERT INTO UserInfo ( 'SteamID', 'Login', 'Password', 'AdminLevel' )"
		query = query .. " VALUES ( " .. steamID .. ", " .. login .. ", " .. password .. ", " .. adminLevel .. " )"
	
		/* Insert team row */
		result				= sql.Query( query )
		if IsSQLError( result ) then
			DEBUG:ErrMsg( "An error occurred while trying to create the user info " .. dbgName .. " -  " .. tostring( sql.LastError() ), "InsertUserInfo" )
		else
			DEBUG:Msg( "The user info " .. dbgName .. " row was successfully inserted", "InsertUserInfo" )
		end
	end
	
	/* Return the result */
	return result
end

end